﻿@inject IDataCacheService _dataCacheService

<MSpeedDial @bind-Value="fab" Class="@Class"
            Bottom
            Right
            Direction="@Direction"
            Style="right:0;bottom:0">
    <ActivatorContent Context="m">
        <MTooltip Bottom>
            <ActivatorContent Context="c">
                @{
                    var attrs = new Dictionary<string, object>();
                    m.Attrs.ToList().ForEach(item => attrs[item.Key] = item.Value);
                    c.Attrs.ToList().ForEach(item => attrs[item.Key] = item.Value);
                }
                <MButton Color="primary" Small Fab @attributes="@attrs" OnClick="OnClick">
                    <MIcon>
                        @Icon
                    </MIcon>
                </MButton>
            </ActivatorContent>
            <ChildContent>
                <span>@Text</span>
            </ChildContent>
        </MTooltip>
    </ActivatorContent>
    <ChildContent>
        @ChildContent
    </ChildContent>
</MSpeedDial>

@code {
    [Parameter]
    public string Direction { get; set; }
    [Parameter]
    public string Icon { get; set; }
    [Parameter]
    public string Text { get; set; }
    [Parameter]
    public string Class { get; set; }
    [Parameter]
    public EventCallback OnClick { get; set; }
    [Parameter]
    public RenderFragment ChildContent { get; set; }


    private bool fab;
}
